﻿@echo off

cd /d %~dp0
set home_dir=%cd%

REM 设置 MAVEN_HOME 系统环境变量
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v MAVEN_HOME /t REG_EXPAND_SZ /d %home_dir% /f

REM 获取当前 PATH 系统环境变量
for /f "tokens=2*" %%A in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH') do set "currentPath=%%B"

REM 更新 PATH 系统环境变量以包含 %MAVEN_HOME%\bin
set "newPath=%currentPath%;%%MAVEN_HOME%%\bin"

REM 更新 PATH 系统环境变量
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH /t REG_EXPAND_SZ /d "%newPath%" /f


